package runtime

import (
	"dog-blog/base/logger"
	"net/http"

	"github.com/gin-gonic/gin"
)

type Application struct {
	engine http.Handler
	logger logger.Logger
}

// NewConfig 默认值
func NewConfig() *Application {
	return &Application{}
}

// SetEngine 设置路由引擎
func (e *Application) SetEngine(engine http.Handler) {
	e.engine = engine
}

// GetEngine 获取路由引擎
func (e *Application) GetEngine() http.Handler {
	if e.engine == nil {
		e.SetEngine(gin.New())
	}
	return e.engine
}

func (e *Application) SetLogger(logger logger.Logger) {
	e.logger = logger
}

func (e *Application) GetLogger() logger.Logger {
	return e.logger
}
